<%--
   Dict Selector
   Copyright (c) 2013 ISPERP
   Version : 1.0.0
 --%>
<%@tag import="org.apache.commons.lang3.StringUtils"%>
<%@tag import="itsm.isperp.module.entity.app.AppDict"%>
<%@tag import="java.util.List"%>
<%@tag import="itsm.isperp.framework.core.context.ContextHolder"%>
<%@tag import="itsm.isperp.module.service.app.AppDictService"%>
<%@ tag language="java" pageEncoding="UTF-8"
	deferredSyntaxAllowedAsLiteral="false" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ attribute name="id" required="true" type="java.lang.String"
	description="唯一标识."%>
<%@ attribute name="value" required="true" type="java.lang.String"
	description="value"%>
<%@ attribute name="valueColumn" required="false"
	type="java.lang.String" description="默认name"%>
<%@ attribute name="typeCode" required="true" type="java.lang.String"
	description="typeCode"%>



<%
	AppDictService appDictService = ContextHolder
			.getSpringBean("appDictService");

	AppDict dict = null;
	if (StringUtils.isEmpty(valueColumn) || valueColumn.equals("name")) {
		dict = appDictService.findByTypeAndNameValue(typeCode, value);
	} else {
		dict = appDictService.findByTypeAndCodeValue(typeCode, value);
	}
	if (dict != null) {
%>

<label id="${id }"><%=dict.getName()%></label>
<%
	}
%>
